import Main from '@/views/Main.vue';

/* 不作为Main组件的子页面展示的页面单独写，如下 */
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: () => import('@/views/login.vue')
};

/* 404 界面 */
export const page404 = {
    path: '/404',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: () => import('@/views/error-page/404.vue')
};

/* 403 界面 */
export const page403 = {
    path: '/403',
    //path: '/:catchAll(.*)*',
    meta: {
        title: '403-权限不足'
    },
    name: 'error',
    component: () => import('@/views/error-page/403.vue')
};



/* 首页 */
export const homeFull = {
    path: '/home_full',
    meta: {
        title: '首页'
    },
    name: 'home_full',
    component: () => import('@/views/Home')
};


export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: () => import('@/views/error-page/500.vue')
};

/* 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里 */
export const appRouter = [
    {
        path: '/',
        icon: 'compose',
        name: 'main',
        title: '系统首页',
        component: Main,
        key:0,
        children:[
          {
            path: 'Home',
            component: () => import('@/views/Home/index.vue'),
            name: 'Home',
            title: '系统首页',
            'icon': 'document-text',
            'meta': {'title': '系统首页', 'key': '0.1', 'keepAlive': true, 'hidden': false}
          },
        ]
    }
];

/* 动态路由且作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里 */
export const dynamicAppRouter = {
    path: '/',
    name: 'dynamicRouter',
    redirect: {name:'home'},
    component: Main,
    children: []
};

export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    component: Main,
    children: []
};

export const micrApp = [];


/* 所有上面定义的路由都要写在下面的routers里 */
export const routers = [
    loginRouter,
    homeFull,
    page500,
    page403,
    page404,
    ...appRouter,
    dynamicAppRouter,
    otherRouter,
    ...micrApp
];
